Repository navigation
perf(manager-context): memoize history_inspect lifecycle checks and scope runtime revision in handoffs query - #9088
Conversation
…cope runtime revision in handoffs query Eliminate the remaining O(N) Effect runtime RPCs and uncached runtime fingerprinting inside tracking.query(): enter effect_runtime_request_scope() for the query, memoize pure history_inspect lifecycle decisions across entries sharing identical Goal refs while holding the Goal lifetime guard, lazily discover legacy ingress files only when external audience recovery needs them, and preserve entry scan order across Goal batches. Signed-off-by: LoopX Agent <[email protected]>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · Gemini (Google, self_reported)
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
在 #9085 (fac7d35a8c) 将 collaboration_goal_scope 锁与注册表读取收敛为按 Goal 分组后,受影响的调用方与维护者包括:调用 loopx_manager_read(view='handoffs') 的 Steward 轮次、独立执行 manager-inbox status 的 CLI 调用方,以及在 source_session_v1 注册表上排查 handoff 历史的维护者。旧路径仍会在持锁循环内对每条命中记录顺序发出 decide_collaboration_lifecycle(..., operation="history_inspect") Effect-runtime IPC,同时独立调用缺少外层 effect_runtime_request_scope(),并在 owner_scope=True 时仍遍历 ingress/*.json。
前/后场景对比:在合成 2,000 条单活跃 Goal 的 source_session_v1 数据上:改动前 origin/main (fac7d35) 会顺序发出 2,000 次 decide_collaboration_lifecycle RPC(含外层 scope 耗时 0.950s,无外层 scope 的独立 query 耗时 8.041s,ManagerInspection.read 耗时 8.615s);改动后 852c481 上三者均只需 1 次 RPC(耗时分别降至 0.203s、0.200s 与 0.568s),并返回相同的 matched=2000 与 12 条分页。
可观测改进效果:tracking.query() 与 ManagerInspection.read(view='handoffs') 将单次查询内的 decide_collaboration_lifecycle RPC 从 O(N) 降为 O(unique Goal ref pairs),在 2,000 条规模下使独立读取耗时下降约 15x–40x,同时保持 matched 计数、coverage.unreadable 统计、排序和受控修订回读结果一致。
明确非目标与边界:本 PR 不放宽 2,000 个文件的目录扫描上限,不改动 TypeScript collaboration.goal_instance.decide 的生命周期判定规则,也不调整单页最多 12 条输出记录之后的 read_linked_work / controlled_request_readback 逐行读取。
改动思路 / Approach
核心思路是在保留 TS collaboration.goal_instance.decide 唯一判定权威的前提下,去除扫描路径上的重复 IPC、重复指纹计算与无效磁盘 IO:
-
纯函数
history_inspect决策缓存:TS 侧collaboration.goal_instance.decide在operation="history_inspect"下仅依赖(profile_id, caller_goal_ref, current_goal_ref, record_goal_ref),因此在单次query()内按规范 JSON 键做内存 memoization(含CollaborationLifecycleRejected拒绝异常),将持锁期间 IPC 次数从$O(N)$ 降为$O(\text{unique Goal ref pairs})$ 。 -
请求级运行时指纹缓存:将 Goal 分组校验与分页投影整体包裹进既有
effect_runtime_request_scope(),使ManagerInspection和 CLI 等无外层作用域调用方复用一次运行时指纹。 -
惰性 legacy provenance 与确定性顺序:
owner_scope=True直接跳过ingress/*.jsonglob;外部查询仅当真正遇到source_channel is None的 legacy 记录时才延迟读取ingress文件;并保留(scan_index, row)以在按 Goal 分组后恢复原始扫描顺序后再排序。
结构评审决策:选择将纯 history_inspect 内存缓存与惰性 ingress 通道加载保留在 tracking.py 中,因为只有该模块在单次查询内顺序扫描多达 2,000 条历史记录,同时继续复用 goal_instance_scope.py 与 effect_runtime.py 的既有类型化控制面边界,不在控制面新增持久状态。当前 PR 边界严格限定为 tracking.py 及其对应回归测试内的可逆性能优化,不包含跨请求持久缓存或分页后 12 条明细展示的进一步合并优化。
| 路径 / 指标(合成 2,000 条记录,非真实生产规模声明) | origin/main (fac7d35a8c) |
852c481b8d(本 PR) |
|---|---|---|
tracking.query(含外层 effect_runtime_request_scope) |
0.950s (decide_rpc=2000) |
0.203s (decide_rpc=1) |
tracking.query(无外层 scope 独立调用) |
8.041s (decide_rpc=2000) |
0.200s (decide_rpc=1) |
ManagerInspection.read(view="handoffs", limit=12) |
8.615s (decide_rpc=2000) |
0.568s (decide_rpc=1) |
具体改动 / Changes
本次改动共涉及 2 个文件:loopx/capabilities/manager_context/tracking.py(+212/-113,其中分页投影块仅随 with effect_runtime_request_scope(): 整体缩进 4 空格)与 tests/test_manager_context_tracking.py(+288/-0)。本优化无独立性能规格文档(no_spec),语义一致性直接以 origin/main (fac7d35a8c) 的 query() 行为及 TS collaboration.goal_instance.decide 契约为准。
关键代码讲解
_lifecycle_cache_key(loopx/capabilities/manager_context/tracking.py:37):校验isinstance(scope, CollaborationGoalScope)后,使用json.dumps(..., sort_keys=True, allow_nan=False)构造(profile_id, caller_key, current_key, record_key)规范键;若遇到非标准 scope 或不可序列化值则返回None,安全退回未缓存路径而不触发误命中或异常。_decide_history_inspect(loopx/capabilities/manager_context/tracking.py:68):查询同一次query()生命周期内的lifecycle_cache;命中允许直接返回,命中拒绝则重新抛出CollaborationLifecycleRejected(rejected_decision),确保冷路径与缓存命中路径向调用方呈现完全一致的异常类型与拒绝负载。_verify_goal_group(loopx/capabilities/manager_context/tracking.py:97):对单一goal_id在一次collaboration_goal_scope持锁内校验该 Goal 的全部候选记录,逐行派生scope_for_caller_goal_ref并调用_entry()与_decide_history_inspect();保持单行(OSError, ValueError, KeyError, TypeError)计数unreadable += 1、以及未注册 Goal 整组失败计入len(group_rows)的原有语义。query(loopx/capabilities/manager_context/tracking.py:136):在owner_scope=True时跳过ingress/*.jsonglob;外部查询通过闭包_legacy_channels()惰性按需加载 provenance 并保持len(ingress_paths) <= 2000完整度语义;对预过滤通过的gid增加isinstance(gid, str)检查;在with effect_runtime_request_scope():内完成分组校验后,先按scan_index还原扫描序,再按(delivered_at, request_id)降序排序并输出分页结果。
对主干的风险 / Risks
未发现阻塞性问题(no blocking findings)。
-
正/反向路径与边界隔离:主路径已通过
tests/test_manager_context_tracking.py与tests/control_plane/test_chat_request_inventory.py(86 passed)验证多 Goal、多历史/活跃goal_instance_id、外部受众 pre-filter 与 legacy provenance;反向路径通过test_query_preserves_unreadable_and_lifecycle_rejection_parity_in_batches覆盖 JSON 损坏、非字符串/非法goal_ref、缺失goal_ref、目录键不匹配、未注册 Goal(2 条)与重复生命周期拒绝(5 条去重为 1 次 RPC),精确维持matched=3与coverage.unreadable=13。 -
适用性与既有边界:活跃生产调用方为
ManagerInspection.read(view="handoffs")与manager-inbox status(scope_fit通过);未引入新开关或权限语义(default_off_isolation与authority_semantics均为not_applicable)。 -
残留风险与未覆盖验证:若单次扫描的 2,000 条记录恰好包含 2,000 对互不相同的
(caller_goal_ref, record_goal_ref),缓存命中率为 0,仍会产生$O(\text{unique pairs})$ 次 RPC(仍优于改前多出的重复指纹重算);仓库全局默认mypy存在一处与本 PR 无关的既有错误(interaction_contract.py:1004),针对tracking.py运行mypy --follow-imports=silent显示新增 3 个辅助函数零报错,原有query/read_linked_work/reply_status存在 4 处既有类型标注缺口。
我的整体评价 / Verdict
本次改动对长程运行效果(long_horizon: improved)和用户体验(user_experience: improved)均有实质提升:彻底消除了 tracking.query() 在高历史条目场景下的 visual_review 为 not_applicable(纯后端查询路径优化,未修改任何 UI 组件、看板视口或渲染文本。未核验范围 unverified_scope: none)。
语义等价性与工程比例方面:输入、过滤、异常计数、排序、受控修订回读与旧仓库/legacy provenance 兼容性均与基线严格一致(observable_semantics: equivalent,repository_reuse: reused,code_volume: necessary / retain,change_proportionality: proportionate / retain);未新增或修改任何协议枚举与状态词汇(semantic_alignment: not_applicable)。
本地验证摘要(exact head 852c481b8da80c81e071ac2c97652967c99bed66,按策略 ci_policy: not_consulted、wait_for_ci: false 不等待远端 CI):
pytest tests/test_manager_context_tracking.py tests/control_plane/test_chat_request_inventory.py: PASS(86 passed)pytest -n 4(含tracking、collaboration_goal_instance、peer_collaboration、chat_request_inventory): PASS(228 passed, 3win32-only skipped)node --experimental-strip-types --test(collaboration_goal_instance_lifecycle&global_manager_read): PASS(27 passed)ruff check/npm run typecheck:control-plane/check_rfc_bilingual.py/loopx check/change-quality verify(cqr_4b05086e0e87f75a4d3a) /canary premerge --tier quick: PASSmypy(全仓默认配置): UNVERIFIED / 既有无关失败(卡在interaction_contract.py:1004)
English verdict: APPROVE at exact head 852c481b8da80c81e071ac2c97652967c99bed66; no blocking findings, tracking.query() lifecycle RPCs drop from 2,000 to O(unique Goal refs) with 86 targeted Python tests, 228/231 cross-suite Python tests (3 Win32-only skipped), 27 TS tests, ruff, typecheck:control-plane, change-quality, and canary premerge quick checks passing locally.
* refactor(core): defer benchmark implementations during capability discovery Preserve the benchmark toolkit public exports and static types while keeping execution and experiment implementations out of metadata discovery. Qualify source and installed Core paths, and reconcile the paired minimal/Standard RFC boundary without changing activation or authority defaults. Signed-off-by: cicolord <[email protected]> * Defer Yardstick evaluation until an enabled Explore read Signed-off-by: cicolord <[email protected]> * Omit empty Todo summary lanes from ordinary Worker context Signed-off-by: cicolord <[email protected]> * fix(update): honor configured archive directories during rollback Signed-off-by: LoopX Agent <[email protected]> * fix(lark): replay recall guard on current main Signed-off-by: huangruiteng <[email protected]> * docs: record the verified LoopX 2.3.0 release baseline Signed-off-by: LoopX Agent <[email protected]> * Preserve quota spend source when prepared work is admitted Signed-off-by: LoopX Agent <[email protected]> * test(quota): qualify native saved complete-Turn checkpoints Signed-off-by: LoopX Agent <[email protected]> * Retry cleanup of an owned file mutation marker Signed-off-by: LoopX Agent <[email protected]> * Keep synthetic Git-path test data outside the public source scan Signed-off-by: LoopX Agent <[email protected]> * fix(quota): share native preparation wait with readiness Signed-off-by: LoopX Agent <[email protected]> * fix(doctor): bind package update readback to its Python environment Signed-off-by: LoopX Agent <[email protected]> * Keep Doctor discovery separate from service activation Signed-off-by: LoopX Agent <[email protected]> * Verify the recorded Python launcher before Doctor probes it Signed-off-by: LoopX Agent <[email protected]> * fix(desktop): require runtime qualification for macOS preview updates Signed-off-by: LoopX Agent <[email protected]> * fix(quota): reuse replan projection owners during recovery Signed-off-by: LoopX Agent <[email protected]> * Qualify Codex 0.169 native context replay on main Signed-off-by: LoopX Agent <[email protected]> * Stop regenerating retired quota view aliases Signed-off-by: LoopX Agent <[email protected]> * fix: pin deferred native context reads to the original capture Signed-off-by: LoopX Agent <[email protected]> * Keep native capture navigation within small output budgets Signed-off-by: LoopX Agent <[email protected]> * Retire legacy heartbeat work prompt generation Signed-off-by: LoopX Agent <[email protected]> * Capture C1 composition failures as receipt diagnostics Signed-off-by: LoopX Agent <[email protected]> * Recover interrupted native Todo readiness from the original Turn Signed-off-by: LoopX Agent <[email protected]> * Revalidate the original lease before publishing resumed native context Signed-off-by: LoopX Agent <[email protected]> * Fence native readiness publication with the canonical lease writer Signed-off-by: LoopX Agent <[email protected]> * fix(scheduler): keep Codex fallback on the original C1 runtime Signed-off-by: LoopX Agent <[email protected]> * fix(scheduler): pin the originating fallback launchers Signed-off-by: LoopX Agent <[email protected]> * Retire the duplicate Codex App scheduler projection Signed-off-by: LoopX Agent <[email protected]> * Seed the recorded scheduler profile in the elapsed-backoff fixture Signed-off-by: LoopX Agent <[email protected]> * Verify canonical cadence on refused and settled Turns Signed-off-by: LoopX Agent <[email protected]> * Pin named Core commands in saved scheduler fallbacks Signed-off-by: LoopX Agent <[email protected]> * fix(research): preserve saved case addresses when a version cannot open Signed-off-by: LoopX Agent <[email protected]> * Preserve citation focus after a saved study refresh Signed-off-by: LoopX Agent <[email protected]> * Capture authenticated LoopX receipts for Research attention (#8790) * feat(research): capture authenticated LoopX attention receipts Signed-off-by: lusendong.6789 <[email protected]> Co-authored-by: TRAE CLI <[email protected]> * fix(research): tighten attention receipt provenance Signed-off-by: lusendong.6789 <[email protected]> Co-authored-by: TRAE CLI <[email protected]> * fix(research): publish attention captures after source validation Signed-off-by: huangruiteng <[email protected]> --------- Signed-off-by: lusendong.6789 <[email protected]> Signed-off-by: huangruiteng <[email protected]> Co-authored-by: TRAE CLI <[email protected]> Co-authored-by: huangruiteng <[email protected]> * Recover the original Session and Turn from a confirmed Chat task Signed-off-by: huangruiteng <[email protected]> * perf(lark,native_chat): eliminate redundant full-directory JSON reparsing in steward chat loops (#9041) * perf(lark,native_chat): avoid full directory reparsing in steward chat loops - Make LarkOwnerAttention._route iterate capture candidates lazily so matching stops at the newest valid p2p capture. - Reuse FileChatDiscovery in PrivateIngressObserver._records while preserving strict field validation and fail-closed errors. - Reuse FileChatDiscovery in ChatExternalConversations.pending so unchanged request journals skip redundant JSON reads and stay mutation-isolated. - Add regression and scan-efficiency tests in tests/test_lark_steward_directory_scan_perf.py. Signed-off-by: LoopX Agent <[email protected]> * fix(native-chat): project small recovery metadata fields to stop data_url memory growth Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * Retire transitional smoke checks and duplicate execution (#9073) Signed-off-by: lusendong.6789 <[email protected]> Co-authored-by: TRAE CLI <[email protected]> * feat(steward): support probe-gated generic continuous_monitor todos with handoff and user actions (#9074) Signed-off-by: LoopX Agent <[email protected]> * Remove redundant defensive prose from prompts and comments (#9072) Remove redundant defensive prose while preserving published heartbeat wrappers and externally managed skill readiness. Validated with 197 related tests, independent historical wrapper migrations and negative cases, installed-skill readback, and current-main quick canary. Existing CI qualification and infrastructure limitations remain recorded in PR #9072. Signed-off-by: lusendong.6789 <[email protected]> Signed-off-by: Lusen Dong <[email protected]> * Keep original Chat retry errors visible during receipt refresh Signed-off-by: LoopX Agent <[email protected]> * fix(steward): tolerate report validator python drift and allow cancel of mid-turn failed reports (#9077) Signed-off-by: LoopX Agent <[email protected]> * feat(steward): add exact-head PR review signals and protected merge confirmation (#9081) Signed-off-by: LoopX Agent <[email protected]> * feat(steward): add isolated OpenViking long-term memory with per-speaker boundaries (#9083) Signed-off-by: LoopX Agent <[email protected]> * refactor(content-ops): slim surface module and eliminate Any (#8961) * refactor(content-ops): slim surface module and eliminate Any Signed-off-by: LoopX Agent <[email protected]> * fix(content-ops): reject malformed angle source_item_ids containers Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * fix(collaboration): batch handoff query Goal lifetime guard lock per Goal (#9085) Signed-off-by: LoopX Agent <[email protected]> * fix(hosts): raise managed service startup readiness timeout to 45s (#9087) Signed-off-by: LoopX Agent <[email protected]> * perf(manager-context): memoize history_inspect lifecycle checks and scope runtime revision in handoffs query (#9088) Eliminate the remaining O(N) Effect runtime RPCs and uncached runtime fingerprinting inside tracking.query(): enter effect_runtime_request_scope() for the query, memoize pure history_inspect lifecycle decisions across entries sharing identical Goal refs while holding the Goal lifetime guard, lazily discover legacy ingress files only when external audience recovery needs them, and preserve entry scan order across Goal batches. Signed-off-by: LoopX Agent <[email protected]> * refactor(lark): slim private_conversations below 2000 lines with net LOC reduction (#8929) Signed-off-by: LoopX Agent <[email protected]> * perf(chat,hosts): skip frontend source re-hashing on immutable installed releases and extend readiness timeout to 90s (#9089) Signed-off-by: LoopX Agent <[email protected]> * refactor(control-plane): split and slim quota monitor_poll_commit (#8885) * refactor(control-plane): split and slim quota monitor_poll_commit Signed-off-by: LoopX Agent <[email protected]> * fix(control-plane): preserve legacy lane budget and observation diagnostic order Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * refactor(quota): slim loopx/quota.py and tighten Any count to zero (#8939) Signed-off-by: LoopX Agent <[email protected]> * refactor(native-chat): slim external_conversations below 2k lines and retire ceiling (#8911) * refactor(native-chat): move steward commission mixin to steward_commands and retire external_conversations ceiling Signed-off-by: LoopX Agent <[email protected]> * fix(native-chat): respect include_raw_response in retained result recovery Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * refactor(chat): slim chat_runtime below 1,500 lines, fix entry-point project_contexts guard, and retire ceiling (#8920) * refactor(chat): move session lifecycle mixin to session_open, deduplicate runtime helpers, and retire ceiling Signed-off-by: LoopX Agent <[email protected]> * fix(chat): drop turn_done_events slot before waking waiters on Thread.start failure Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * fix(steward): paginate open PR signal GraphQL, allow signal-unavailable monitor recovery, and cache private delivery scans (#9093) Signed-off-by: LoopX Agent <[email protected]> * perf(lark,native_chat): back off noop recovery retries and cache recovery lookups (#9096) Signed-off-by: LoopX Agent <[email protected]> * perf(native_chat,lark): cache unchanged quota backlog health and interrupt observations (#9098) Signed-off-by: LoopX Agent <[email protected]> * perf(lark,native_chat): coalesce listener snapshots and cache recovery event summaries (#9100) Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: cicolord <[email protected]> Signed-off-by: LoopX Agent <[email protected]> Signed-off-by: huangruiteng <[email protected]> Signed-off-by: lusendong.6789 <[email protected]> Signed-off-by: Lusen Dong <[email protected]> Co-authored-by: cicolord <[email protected]> Co-authored-by: huangruiteng <[email protected]> Co-authored-by: Lusen Dong <[email protected]> Co-authored-by: TRAE CLI <[email protected]>
* fix(cli): preserve typed runtime diagnostics in Turn failures Signed-off-by: LoopX Agent <[email protected]> * feat(steward): support per-endpoint model preferences and Codex-to-Antigravity failover (#9141) Signed-off-by: LoopX Agent <[email protected]> * Keep the prepared Chat adapter available to a retry (#9134) A failed worker start can finish cleanup after a same-turn retry has selected the adapter. Keep its lifetime tied to the Session and let failed dispatch release its own worker registration. The regression asserts one upstream turn and explicit adapter closure with the Session. Port the fix from 4453e4bdd77486ec14b952f88ca893310b32e26c. (cherry picked from commit 173e42b4f051b885c3a3389e1cad9c5722f7b7dd) Signed-off-by: LoopX Agent <[email protected]> * fix(steward): recover zero-effect monitors and cleared-replan reports (#9143) Signed-off-by: LoopX Agent <[email protected]> * fix(steward): admit flexible_primary_available executor transitions in conversation_scope (#9145) Signed-off-by: LoopX Agent <[email protected]> * Verify quota gate scope through signed lane references (#9101) * test(quota): verify scoped gates through complete lane references Signed-off-by: LoopX Agent <[email protected]> * Test canonical quota gates in both public response modes Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * Test C1 planning and Host input from the original quota capture (#9102) * Use recorded quota decisions in the no-Todo settlement regression Signed-off-by: LoopX Agent <[email protected]> * Exercise the complete Host prompt from the captured quota source Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * Prepare the CLI budget baseline with a private Git index (#9103) Signed-off-by: LoopX Agent <[email protected]> * Exercise C1 Goal delivery and bound replan from the saved source (#9104) Signed-off-by: LoopX Agent <[email protected]> * Keep long claim overlap scopes on demand (#9086) * Link long thin-claim overlap lists to their receipts Signed-off-by: LoopX Agent <[email protected]> * Read claim overlap details without copying the lease Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * fix(quota): preserve explicit Monitor Todo selection (#9099) Carry Todo selection provenance into quota admission. Preserve explicit secondary Monitor polling and recovery from previously admitted receipts. Signed-off-by: LoopX Agent <[email protected]> * Keep ready Todo scope details on the required context read (#9106) Signed-off-by: LoopX Agent <[email protected]> * Fix archive rollback with custom install directories (#9066) * refactor(core): defer benchmark implementations during capability discovery Preserve the benchmark toolkit public exports and static types while keeping execution and experiment implementations out of metadata discovery. Qualify source and installed Core paths, and reconcile the paired minimal/Standard RFC boundary without changing activation or authority defaults. Signed-off-by: cicolord <[email protected]> * Defer Yardstick evaluation until an enabled Explore read Signed-off-by: cicolord <[email protected]> * Omit empty Todo summary lanes from ordinary Worker context Signed-off-by: cicolord <[email protected]> * fix(update): honor configured archive directories during rollback Signed-off-by: LoopX Agent <[email protected]> * fix(lark): replay recall guard on current main Signed-off-by: huangruiteng <[email protected]> * docs: record the verified LoopX 2.3.0 release baseline Signed-off-by: LoopX Agent <[email protected]> * Preserve quota spend source when prepared work is admitted Signed-off-by: LoopX Agent <[email protected]> * test(quota): qualify native saved complete-Turn checkpoints Signed-off-by: LoopX Agent <[email protected]> * Retry cleanup of an owned file mutation marker Signed-off-by: LoopX Agent <[email protected]> * Keep synthetic Git-path test data outside the public source scan Signed-off-by: LoopX Agent <[email protected]> * fix(quota): share native preparation wait with readiness Signed-off-by: LoopX Agent <[email protected]> * fix(doctor): bind package update readback to its Python environment Signed-off-by: LoopX Agent <[email protected]> * Keep Doctor discovery separate from service activation Signed-off-by: LoopX Agent <[email protected]> * Verify the recorded Python launcher before Doctor probes it Signed-off-by: LoopX Agent <[email protected]> * fix(desktop): require runtime qualification for macOS preview updates Signed-off-by: LoopX Agent <[email protected]> * fix(quota): reuse replan projection owners during recovery Signed-off-by: LoopX Agent <[email protected]> * Qualify Codex 0.169 native context replay on main Signed-off-by: LoopX Agent <[email protected]> * Stop regenerating retired quota view aliases Signed-off-by: LoopX Agent <[email protected]> * fix: pin deferred native context reads to the original capture Signed-off-by: LoopX Agent <[email protected]> * Keep native capture navigation within small output budgets Signed-off-by: LoopX Agent <[email protected]> * Retire legacy heartbeat work prompt generation Signed-off-by: LoopX Agent <[email protected]> * Capture C1 composition failures as receipt diagnostics Signed-off-by: LoopX Agent <[email protected]> * Recover interrupted native Todo readiness from the original Turn Signed-off-by: LoopX Agent <[email protected]> * Revalidate the original lease before publishing resumed native context Signed-off-by: LoopX Agent <[email protected]> * Fence native readiness publication with the canonical lease writer Signed-off-by: LoopX Agent <[email protected]> * fix(scheduler): keep Codex fallback on the original C1 runtime Signed-off-by: LoopX Agent <[email protected]> * fix(scheduler): pin the originating fallback launchers Signed-off-by: LoopX Agent <[email protected]> * Retire the duplicate Codex App scheduler projection Signed-off-by: LoopX Agent <[email protected]> * Seed the recorded scheduler profile in the elapsed-backoff fixture Signed-off-by: LoopX Agent <[email protected]> * Verify canonical cadence on refused and settled Turns Signed-off-by: LoopX Agent <[email protected]> * Pin named Core commands in saved scheduler fallbacks Signed-off-by: LoopX Agent <[email protected]> * fix(research): preserve saved case addresses when a version cannot open Signed-off-by: LoopX Agent <[email protected]> * Preserve citation focus after a saved study refresh Signed-off-by: LoopX Agent <[email protected]> * Capture authenticated LoopX receipts for Research attention (#8790) * feat(research): capture authenticated LoopX attention receipts Signed-off-by: lusendong.6789 <[email protected]> Co-authored-by: TRAE CLI <[email protected]> * fix(research): tighten attention receipt provenance Signed-off-by: lusendong.6789 <[email protected]> Co-authored-by: TRAE CLI <[email protected]> * fix(research): publish attention captures after source validation Signed-off-by: huangruiteng <[email protected]> --------- Signed-off-by: lusendong.6789 <[email protected]> Signed-off-by: huangruiteng <[email protected]> Co-authored-by: TRAE CLI <[email protected]> Co-authored-by: huangruiteng <[email protected]> * Recover the original Session and Turn from a confirmed Chat task Signed-off-by: huangruiteng <[email protected]> * perf(lark,native_chat): eliminate redundant full-directory JSON reparsing in steward chat loops (#9041) * perf(lark,native_chat): avoid full directory reparsing in steward chat loops - Make LarkOwnerAttention._route iterate capture candidates lazily so matching stops at the newest valid p2p capture. - Reuse FileChatDiscovery in PrivateIngressObserver._records while preserving strict field validation and fail-closed errors. - Reuse FileChatDiscovery in ChatExternalConversations.pending so unchanged request journals skip redundant JSON reads and stay mutation-isolated. - Add regression and scan-efficiency tests in tests/test_lark_steward_directory_scan_perf.py. Signed-off-by: LoopX Agent <[email protected]> * fix(native-chat): project small recovery metadata fields to stop data_url memory growth Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * Retire transitional smoke checks and duplicate execution (#9073) Signed-off-by: lusendong.6789 <[email protected]> Co-authored-by: TRAE CLI <[email protected]> * feat(steward): support probe-gated generic continuous_monitor todos with handoff and user actions (#9074) Signed-off-by: LoopX Agent <[email protected]> * Remove redundant defensive prose from prompts and comments (#9072) Remove redundant defensive prose while preserving published heartbeat wrappers and externally managed skill readiness. Validated with 197 related tests, independent historical wrapper migrations and negative cases, installed-skill readback, and current-main quick canary. Existing CI qualification and infrastructure limitations remain recorded in PR #9072. Signed-off-by: lusendong.6789 <[email protected]> Signed-off-by: Lusen Dong <[email protected]> * Keep original Chat retry errors visible during receipt refresh Signed-off-by: LoopX Agent <[email protected]> * fix(steward): tolerate report validator python drift and allow cancel of mid-turn failed reports (#9077) Signed-off-by: LoopX Agent <[email protected]> * feat(steward): add exact-head PR review signals and protected merge confirmation (#9081) Signed-off-by: LoopX Agent <[email protected]> * feat(steward): add isolated OpenViking long-term memory with per-speaker boundaries (#9083) Signed-off-by: LoopX Agent <[email protected]> * refactor(content-ops): slim surface module and eliminate Any (#8961) * refactor(content-ops): slim surface module and eliminate Any Signed-off-by: LoopX Agent <[email protected]> * fix(content-ops): reject malformed angle source_item_ids containers Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * fix(collaboration): batch handoff query Goal lifetime guard lock per Goal (#9085) Signed-off-by: LoopX Agent <[email protected]> * fix(hosts): raise managed service startup readiness timeout to 45s (#9087) Signed-off-by: LoopX Agent <[email protected]> * perf(manager-context): memoize history_inspect lifecycle checks and scope runtime revision in handoffs query (#9088) Eliminate the remaining O(N) Effect runtime RPCs and uncached runtime fingerprinting inside tracking.query(): enter effect_runtime_request_scope() for the query, memoize pure history_inspect lifecycle decisions across entries sharing identical Goal refs while holding the Goal lifetime guard, lazily discover legacy ingress files only when external audience recovery needs them, and preserve entry scan order across Goal batches. Signed-off-by: LoopX Agent <[email protected]> * refactor(lark): slim private_conversations below 2000 lines with net LOC reduction (#8929) Signed-off-by: LoopX Agent <[email protected]> * perf(chat,hosts): skip frontend source re-hashing on immutable installed releases and extend readiness timeout to 90s (#9089) Signed-off-by: LoopX Agent <[email protected]> * refactor(control-plane): split and slim quota monitor_poll_commit (#8885) * refactor(control-plane): split and slim quota monitor_poll_commit Signed-off-by: LoopX Agent <[email protected]> * fix(control-plane): preserve legacy lane budget and observation diagnostic order Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * refactor(quota): slim loopx/quota.py and tighten Any count to zero (#8939) Signed-off-by: LoopX Agent <[email protected]> * refactor(native-chat): slim external_conversations below 2k lines and retire ceiling (#8911) * refactor(native-chat): move steward commission mixin to steward_commands and retire external_conversations ceiling Signed-off-by: LoopX Agent <[email protected]> * fix(native-chat): respect include_raw_response in retained result recovery Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * refactor(chat): slim chat_runtime below 1,500 lines, fix entry-point project_contexts guard, and retire ceiling (#8920) * refactor(chat): move session lifecycle mixin to session_open, deduplicate runtime helpers, and retire ceiling Signed-off-by: LoopX Agent <[email protected]> * fix(chat): drop turn_done_events slot before waking waiters on Thread.start failure Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * fix(steward): paginate open PR signal GraphQL, allow signal-unavailable monitor recovery, and cache private delivery scans (#9093) Signed-off-by: LoopX Agent <[email protected]> * perf(lark,native_chat): back off noop recovery retries and cache recovery lookups (#9096) Signed-off-by: LoopX Agent <[email protected]> * perf(native_chat,lark): cache unchanged quota backlog health and interrupt observations (#9098) Signed-off-by: LoopX Agent <[email protected]> * perf(lark,native_chat): coalesce listener snapshots and cache recovery event summaries (#9100) Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: cicolord <[email protected]> Signed-off-by: LoopX Agent <[email protected]> Signed-off-by: huangruiteng <[email protected]> Signed-off-by: lusendong.6789 <[email protected]> Signed-off-by: Lusen Dong <[email protected]> Co-authored-by: cicolord <[email protected]> Co-authored-by: huangruiteng <[email protected]> Co-authored-by: Lusen Dong <[email protected]> Co-authored-by: TRAE CLI <[email protected]> * refactor(issue-fix): consolidate maintainer-correction admission and slim pr_lifecycle (#8897) Signed-off-by: LoopX Agent <[email protected]> * Fix truncated requests and responses in the Codex API relay (#8713) * fix(codex relay): fence incomplete model requests before drain Signed-off-by: LoopX Agent <[email protected]> * fix(codex relay): surface incomplete upstream responses Port the verified response framing fix to the request-admission branch. Original candidate 27bc3aee311cdfc6a00466ff9d3b58c7db36e01b. Signed-off-by: LoopX Agent <[email protected]> * Bound Codex relay writes to clients that stop reading Signed-off-by: LoopX Agent <[email protected]> * Reject upstream chunked responses missing the trailer terminator Signed-off-by: LoopX Agent <[email protected]> * Validate upstream chunk data delimiters before relay completion Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * fix(release): repair dsh closeout test, antigravity failover alias, and release download retry (#9147) Signed-off-by: LoopX Agent <[email protected]> * docs(release): update v2.4.0 release notes and dsh-loopx-plugin 0.1.1-beta.7 README (#9149) Signed-off-by: LoopX Agent <[email protected]> * fix(chat): recover saved answers and diagnose lost workers (#9120) * fix(chat): recover saved answers and diagnose lost workers Signed-off-by: LoopX Agent <[email protected]> * style(lark): keep private_conversations within module line budget Signed-off-by: LoopX Agent <[email protected]> * fix(chat): retain execution_worker_exited in pending backlog count Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * fix(chat): resume steward requests lost before dispatch (#9125) Signed-off-by: LoopX Agent <[email protected]> * fix(benchmark): restore frozen v1 archives and align checkpoint/runtime tests with C1 defaults (#9151) Signed-off-by: LoopX Agent <[email protected]> * fix(release): stabilize CLI help, architecture guards, onboarding gate, and public smokes (#9152) Signed-off-by: LoopX Agent <[email protected]> * fix(steward): recover report selection across python upgrades and prevent queue kill on observation monitors (#9155) Signed-off-by: LoopX Agent <[email protected]> * fix(release): align extensions, chat, presentation, and transport tests for v2.4.0 (#9156) Signed-off-by: LoopX Agent <[email protected]> * fix(control-plane): stabilize v2.4.0 quota, turn-envelope, and capabilities slice (Slice B1) (#9154) * fix(control-plane): stabilize v2.4.0 quota, turn-envelope, and capabilities slice Signed-off-by: LoopX Agent <[email protected]> * fix(quota): preserve tokenless identity and exact numeric types in attach_complete_turn_context Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * fix(steward): recover frozen report contract failures and rebind resumed task leases (#9157) Signed-off-by: LoopX Agent <[email protected]> * fix(steward): recover pre-dispatch runtime failures across endpoints and stop receipt-unknown disk churn (#9159) Signed-off-by: LoopX Agent <[email protected]> * fix(control_plane): align lease recovery, settlement readback, and runtime fixtures (#9158) * fix(control_plane): align lease recovery, settlement readback, and runtime fixtures Signed-off-by: LoopX Agent <[email protected]> * fix(control_plane): forward record_capture in worker outage test and harden version type guard Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * fix(control-plane): stabilize v2.4.0 explore, context, and checkpoint tail slice (Slice B4) (#9161) Signed-off-by: LoopX Agent <[email protected]> * fix(control-plane): stabilize v2.4.0 replan, monitor recovery, and staged-read slice (Slice B5) (#9160) Signed-off-by: LoopX Agent <[email protected]> * docs(release): reconcile final v2.4.0 stabilization PRs and boundary wording (#9162) * docs(release): reconcile final v2.4.0 stabilization PRs and boundary wording Signed-off-by: LoopX Agent <[email protected]> * docs(release): align #9158 and #9161 descriptions with verified commits Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * fix(steward): tolerate minor JSON delimiter glitches and recover saved report candidates (#9164) Signed-off-by: LoopX Agent <[email protected]> * fix(control-plane): preserve bound yardstick reversals in native replan openings (#9165) Signed-off-by: LoopX Agent <[email protected]> * fix(native-chat): recover loopback relay 401 failures and isolate test auth (#9167) Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> Signed-off-by: cicolord <[email protected]> Signed-off-by: huangruiteng <[email protected]> Signed-off-by: lusendong.6789 <[email protected]> Signed-off-by: Lusen Dong <[email protected]> Co-authored-by: cicolord <[email protected]> Co-authored-by: huangruiteng <[email protected]> Co-authored-by: Lusen Dong <[email protected]> Co-authored-by: TRAE CLI <[email protected]>
Summary
Eliminates the remaining$O(N)$
decide_collaboration_lifecycle(..., operation="history_inspect")Effect-runtime RPC and uncached runtime-fingerprint overhead inloopx.capabilities.manager_context.tracking.query()across up to 2,000 scanned handoff entries (building on #9085's per-Goalcollaboration_goal_scopelock batching):history_inspectdecision memoization (_lifecycle_cache_key,_decide_history_inspect): cachesdecide_collaboration_lifecycleoutcomes (includingCollaborationLifecycleRejectedexceptions) across entries sharing(profile_id, caller_goal_ref, current_goal_ref, record_goal_ref), bounding Effect-runtime RPCs inside each held Goal lifetime fence toeffect_runtime_request_scope): wraps Goal verification and page projection so standalone callers (ManagerInspection.read(view="handoffs"),manager-inbox status) reuse the cached runtime fingerprint rather than recomputing it per RPC._verify_goal_group): skipsingress/*.jsonglobbing onowner_scope=True, defers_legacy_channels()reads unless a matched external candidate hassource_channel is None(len(ingress_paths) <= 2000), enforcesisinstance(gid, str), preserves exactunreadablefailure counting, and restores scan order prior to(delivered_at, request_id)sorting.tests/test_manager_context_tracking.py): addstest_query_bounds_registry_loads_and_lifecycle_rpcs_across_many_entriesandtest_query_preserves_unreadable_and_lifecycle_rejection_parity_in_batches.Benchmark (2,000
source_session_v1Entries, Single Active Goal Instance)origin/main(fac7d35a8c)852c481b8d)tracking.query(insideeffect_runtime_request_scope)0.950s(load=1,decide_rpc=2000)0.203s(load=1,decide_rpc=1) — ~4.7x fastertracking.query(unscoped standalone caller)8.041s(load=1,decide_rpc=2000)0.200s(load=1,decide_rpc=1) — ~40.2x fasterManagerInspection.read(view="handoffs", limit=12)8.615s(load=13,decide_rpc=2000)0.568s(load=13,decide_rpc=1) — ~15.2x fasterValidation
pytest tests/test_manager_context_tracking.py tests/control_plane/test_chat_request_inventory.py:86 passedpytest -n 4 tests/test_manager_context_tracking.py tests/test_collaboration_goal_instance.py tests/test_peer_collaboration.py tests/control_plane/test_chat_request_inventory.py:228 passed, 3 skipped(@pytest.mark.skipif(sys.platform != "win32")Win32-only regressions)node --experimental-strip-types --test tests/control_plane_ts/collaboration_goal_instance_lifecycle.test.ts tests/control_plane_ts/global_manager_read.test.ts:27 passedruff check loopx/capabilities/manager_context/tracking.py tests/test_manager_context_tracking.py: passednpm run typecheck:control-plane: passedscripts/check_rfc_bilingual.py --base origin/main --head HEAD&git diff --check origin/main...HEAD&loopx check --scan-path ...: clean (0errors,0warnings)loopx change-quality verify(receipt_id=cqr_4b05086e0e87f75a4d3a,decision=pass) &loopx canary premerge --tier quick --from-git-diff --git-diff-base origin/main:merge_gate_passed=true(direct_failure_count=0,run_failure_count=0)mypynote: repo defaultmypyfails on pre-existing unrelatedloopx/control_plane/work_items/interaction_contract.py:1004; targetedmypy --follow-imports=silent loopx/capabilities/manager_context/tracking.pyshows 0 errors on newly added helpers and 4 pre-existing untyped-function/var errors on pre-existingquery/read_linked_work/reply_status.